<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script>
    function changeCode(){
        //得到图片对象
        const imgObj = document.getElementById("codeImg");
        imgObj.src = "/checkCode?"+Math.random();
    }
</script>
<body>
    用户名：<input type="text" name="name"><br>
    密码：<input type="password" name="pwd"><br>
    验证码:<img src="/checkCode" id="codeImg"><br>
    <a href="javascript:changeCode()">看不清楚换一张</a>
</body>
</html>